package com.quanshu.exchange.ui.gui.profile.order_fragment;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by xiniu003 on 2018/1/12.
 */

public class OrderAdapter extends FragmentPagerAdapter {

    private List<String> titleList;//标题集合
    private List<Fragment> fragments;//页面集合

    public OrderAdapter(FragmentManager fm, List<String> titleList, List<Fragment> fragments) {
        super(fm);
        this.titleList = titleList;
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return titleList.get(position);
    }
}
